console.log(JSON.parse(localStorage.getItem('history')))
// document.querySelector('.search span:nth-child(2)').innerHTML = JSON.parse(localStorage.getItem('history'))
// document.querySelector('.search span:nth-child(2)').innerHTML = location.hash
// document.querySelector('header a').addEventListener('click', () => {
//     location.href = './classify.html'
//     // location.href = './search.html'

// })

const back = document.querySelector('header a')
back.addEventListener('click', function () {
  history.go(-1)
})

document.querySelector('.search').addEventListener('click', () => {
  location.href = './search.html'
})

async function tabulation() {
  const res = await axios({
    url: '/goods/list',
  })
  console.log(res.data.data.list.data)
  document.querySelector('.items').innerHTML = res.data.data.list.data.map(ele => {
    // console.log(ele)
    const { goods_name, goods_image, goods_sales, goods_price_max, line_price_max } = ele
    return `
        <a href="javascript:;">
          <div class="left">
            <img src="${goods_image}" alt="" />
          </div>
          <div class="right">
            <h3 class="ellipsis-2">${goods_name}</h3>
            <p>已售${goods_sales}件</p>
            <span class="price">¥${goods_price_max}<i class="old">¥${line_price_max}</i></span>
          </div>
        </a>
        `
  }).join('')

}
tabulation()